<?php
include 'header.php';

?>
<div style="padding: 10px;">
<h1>Are you sure?</h1>



<?php //delete products or pages?

if (!empty($items)) {
    
    //delete products
    $tobedeleted = count($items);
    ?>

    <p>
    Are you sure you want to <red>delete</red> the following <?=$tobedeleted?> item<?php echo ( $tobedeleted > 1 ? 's' : ''); ?>?    
    </p>
    <ul>
    <?php foreach ($items as $item) { ?>
    <li><?php print_r( $item ); ?></li>
    <?php } ?>
    </ul>

    <form action="<?php echo base_url(); ?>index.php/admin/products/yesiamsure" method="POST">
    <input type="submit" style="font-size: 12pt; margin-right: 20px; border: none; color: green; background: none; cursor: pointer" value="Yes, Delete the above item<?php echo ( $tobedeleted > 1 ? 's' : ''); ?>" />
    <a style="text-decoration: none" href="<?php echo base_url(); ?>index.php/admin/products/page/<?php echo $offset; ?>">No, DO NOT Delete the above item<?php echo ( $tobedeleted > 1 ? 's' : ''); ?></a>
    <?php foreach ($items as $item) { ?>
    <input type="hidden" name="items[]" value="<?php echo $item; ?>" />
    <?php } ?>
    </form>

    <?php
} else if (!empty($pages)) {

    //delete pages
    
    $tobedeleted = count($pages);
    
    ?>
    <p>
    Are you sure you want to <red>delete</red> the following <?=$tobedeleted?> page<?php echo ( $tobedeleted > 1 ? 's' : ''); ?>?    
    </p>
    <ul>
    <?php foreach ($pages as $page) { ?>
    <li><?php print_r( $page ); ?></li>
    <?php } ?>
    </ul>

    <form action="<?php echo base_url(); ?>index.php/admin/pages/yesiamsure" method="POST">
    <input type="submit" style="font-size: 12pt; margin-right: 20px; border: none; color: green; background: none; cursor: pointer" value="Yes, Delete the above page<?php echo ( $tobedeleted > 1 ? 's' : ''); ?>" />
    <a style="text-decoration: none" href="<?php echo base_url(); ?>index.php/admin/pages/page/<?php echo $offset; ?>">No, DO NOT Delete the above page<?php echo ( $tobedeleted > 1 ? 's' : ''); ?></a>
    <?php foreach ($pages as $page) { ?>
    <input type="hidden" name="pages[]" value="<?php echo $page; ?>" />
    <?php } ?>
    </form> 

    <?php
} else if (!empty($deletecats)) {

    //delete categories
    
    $tobedeleted = count($deletecats);
    
    ?>
    <p>
    Are you sure you want to <red>delete</red> the following <?=$tobedeleted?> categor<?php echo ( $tobedeleted > 1 ? 'ies' : 'y'); ?>?    
    </p>
    <ul>
    <?php foreach ($catnames as $category) { ?>
    <li><?php print_r( $category ); ?></li>
    <?php } ?>
    </ul>
    

    <form action="<?php echo base_url(); ?>index.php/admin/category/yesiamsure" method="POST">
    <input type="submit" style="font-size: 12pt; margin-right: 20px; border: none; color: green; background: none; cursor: pointer" value="Yes, Delete the above categor<?php echo ( $tobedeleted > 1 ? 'ies' : 'y'); ?>" />
    <a style="text-decoration: none" href="<?php echo base_url(); ?>index.php/admin/category/">No, DO NOT Delete the above categor<?php echo ( $tobedeleted > 1 ? 'ies' : 'y'); ?></a>
    <?php foreach ($deletecats as $cat) { ?>
    <input type="hidden" name="categories[<?=$cat?>]" value="<?php echo $cat; ?>" />
    <?php } ?>
    <?= isset($event) ? "<input type='hidden' name='event' value='TRUE' />" : "" ?>
    </form> 

    <?php
}
?>

</div>
<?php
include 'footer.php';
?>